﻿//
// Created: 2018/9/6
// Author: chenqiang
//
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using Model.Util;

namespace Model.Util.Map
{
    internal  class CategoryMap:EntityTypeConfiguration< Category >    
    {
        public CategoryMap()
        {
             this.ToTable("Category");
             this.HasKey(i => new { i.CategoryID });
             this.Property(i => i.CategoryID).HasColumnName("CategoryID");                     
             this.Property(i => i.DisplayOrder).HasColumnName("DisplayOrder");                     
             this.Property(i => i.Name).HasColumnName("Name");                     
             this.Property(i => i.PriceRange).HasColumnName("PriceRange");                     
             this.Property(i => i.ParentId).HasColumnName("ParentId");                     
             this.Property(i => i.Layer).HasColumnName("Layer");                     
             this.Property(i => i.HasChild).HasColumnName("HasChild");                     
             this.Property(i => i.Path).HasColumnName("Path");                     
        }   
    }
    
     public static class CategoryMapExtensions
    {
        public static void UserCategoryMap(this DbModelBuilder pModelBuilder)
        {
            pModelBuilder.Configurations.Add(new CategoryMap());
        }
    }
}